﻿<script type="text/javascript">
function myfunct(question_id,user_id,create_at_month,create_at_day,create_at_year,answer_id,point,check)
{	
 	document.getElementById('result_question_id').value=question_id;
 	document.getElementById('result_user_id').value=user_id;
 	document.getElementById('result_create_at_month').value=create_at_month;
 	document.getElementById('result_create_at_day').value=create_at_day;
 	document.getElementById('result_create_at_year').value=create_at_year;
 	document.getElementById('result_answer_id').value=answer_id;
 	document.getElementById('result_point').value=point;
 	if(check==1)
 	{
 		document.getElementById('result_check').checked=true;
 	}
 	else
 	{
 		document.getElementById('result_check').checked=false;
 	}	
 	document.getElementById('myform').submit();
} 
</script>

<h1>Вопросы</h1>
<div style="display: none;">
	<form id="myform" action="<?php echo url_for('result/create') ?>" method="POST">
  		<table>
    		<?php echo $form ?>  
    		<tr>
      		<td colspan="2"></td>
    		</tr>
  		</table>  
	</form>
</div>

<?php foreach ($answers as $answer): ?>
<div class="questions">
  <?php echo $answer->getBody() ?>
</div>

<div class="answers">
  <ul>
  <?php $zz=0;?> 
  <?php foreach ($answer->getActiveJobs() as $i => $ans): $zz++;?>
  <li>
    <?php if($ans->getCheck()==''){ $getCheck=0;}else{$getCheck=$ans->getCheck();}  ?>	
		<a href="#" onclick="myfunct(<?php echo $answer->getId().','.$userss.','.(date('n')).','.(date('j')).','.(date('Y')).','.$ans->getId().','.$ans->getPoint().','.$getCheck?>);"><?php echo $ans->getBody() ?></a>
  </li> 
  <?php endforeach; ?>
  </ul>
</div>
<?php endforeach; ?> 


  